package br.cin.ufpe.corba.iiop;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

public class RequestBody {

	private Object[] arguments;

	public void setArguments(Object[] arguments) {
		this.arguments = arguments;		
	}
	
	public Object[] getArguments() {
		return this.arguments;
	}
	
	public void write(OutputStream out) throws IOException {
		ObjectOutputStream oos = new ObjectOutputStream(out);
		oos.writeObject(arguments);
	}

	public static RequestBody read(InputStream in) throws IOException, ClassNotFoundException {
		ObjectInputStream ois = new ObjectInputStream(in);
		RequestBody body = new RequestBody();
		body.setArguments((Object[]) ois.readObject());
		return body;
	}

}
